Suppress spurious deprecated declaration warnings
authorDan Handley <[email protected]>
Tue, 27 Feb 2018 13:00:43 +0000 (13:00 +0000)
committerDan Handley <[email protected]>
Thu, 1 Mar 2018 16:14:29 +0000 (16:14 +0000)
Some generic compatibility functions emit deprecated declaration warnings
even when platforms do not use the deprecated functions directly. This
can be confusing. Suppress these warnings by using:
`#pragma GCC diagnostic ignored "-Wdeprecated-declarations"`

Also emit a runtime warning if the weak plat/common implemntation of
plat_get_syscnt_freq2() is used, as this implies the platform has not
migrated from plat_get_syscnt_freq(). The deprecated  declaration warnings
only help detect when platforms are calling deprecated functions, not when
they are defining deprecated functions.

Fixes ARM-software/tf-issues#550

Change-Id: Id14a92279c2634c1e76db8ef210da8affdbb2a5d
Signed-off-by: Dan Handley <[email protected]>
bl31/bl31_context_mgmt.c
plat/common/aarch64/plat_common.c

index 123e623c5177268cb2f79734a1edbdcf2f3fe2fa..7d2c8938522e66dbb60dc3365e7c7289d2c008a2 100644 (file)
@@ -79,7 +79,13 @@ void *cm_get_context_by_mpidr(uint64_t mpidr, uint32_t security_state)
 {
        assert(sec_state_is_valid(security_state));
 
+       /*
+        * Suppress deprecated declaration warning in compatibility function
+        */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
        return cm_get_context_by_index(platform_get_core_pos(mpidr), security_state);
+#pragma GCC diagnostic pop
 }
 
 /*******************************************************************************
@@ -90,8 +96,14 @@ void cm_set_context_by_mpidr(uint64_t mpidr, void *context, uint32_t security_st
 {
        assert(sec_state_is_valid(security_state));
 
+       /*
+        * Suppress deprecated declaration warning in compatibility function
+        */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
        cm_set_context_by_index(platform_get_core_pos(mpidr),
                                                 context, security_state);
+#pragma GCC diagnostic pop
 }
 
 /*******************************************************************************
@@ -104,7 +116,15 @@ void cm_init_context(uint64_t mpidr, const entry_point_info_t *ep)
        if ((mpidr & MPIDR_AFFINITY_MASK) ==
                        (read_mpidr_el1() & MPIDR_AFFINITY_MASK))
                cm_init_my_context(ep);
-       else
+       else {
+               /*
+                * Suppress deprecated declaration warning in compatibility
+                * function
+                */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
                cm_init_context_by_index(platform_get_core_pos(mpidr), ep);
+#pragma GCC diagnostic pop
+       }
 }
-#endif
+#endif /* ERROR_DEPRECATED */
index 080d3569819842ffa0b6644c518031495890e4d3..ddd29f29be97e8e5fe5d62ad6762ec200a9985ae 100644 (file)
@@ -65,7 +65,15 @@ unsigned int platform_core_pos_helper(unsigned long mpidr)
 #if !ERROR_DEPRECATED
 unsigned int plat_get_syscnt_freq2(void)
 {
+       WARN("plat_get_syscnt_freq() is deprecated\n");
+       WARN("Please define plat_get_syscnt_freq2()\n");
+       /*
+        * Suppress deprecated declaration warning in compatibility function
+        */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
        unsigned long long freq = plat_get_syscnt_freq();
+#pragma GCC diagnostic pop
 
        assert(freq >> 32 == 0);